home *** CD-ROM | disk | FTP | other *** search
- Path: news2.cais.com!news
- From: Nehal Trivedi <ntrivedi@cais.com>
- Newsgroups: comp.object,comp.lang.c++
- Subject: Re: Defining Object Associations
- Date: Wed, 27 Mar 1996 00:33:57 -0500
- Organization: Instant Karma
- Message-ID: <3158D345.12A4@cais.com>
- References: <4j9ens$jtq@crchh327.rich.bnr.ca>
- NNTP-Posting-Host: ntrivedi.cais.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Bret Bieghler wrote:
- >
- > Are there any preferences to defining object associations in
- > C++. My working system has several objects that must all
- > communicate with each other, and many objects have to be in
- > existence before creating another certain type.
- > ......
- >
- > Thanks for any suggestions you may have.
- >
- > Regards,
- >
- > Joseph A. Bell
- > Nortel Technologies
-
- I believe that you should take another look at your class hierarchy - do some
- OOAD. There are several things that come to mind when I read your description of
- the problem:
- - How big is this group of inter-related classes?
- - What is their life-cycle? Who is responsible for creating and deleting them?
- - What are the usage dependencies?
- and so on.
- The best way to decide is to do some OOAD first. Then draw some instance diagrams
- and some object interaction diagrams and see what the picture looks like. Setting
- all relationships in the constructor can cause a dependency management headache.
- There are design patterns such as object factories that can be useful. I would
- urge you to use global collections of references/pointers and stuff like that
- only as a last resort, especially if you are planning on using DLLs or threads.
-
- Thanks
- Nehal Trivedi
-